1. EZEE AI: The Easy Artificial Intelligence platform
2. Introduction
Our Machine2Learn EZEE AI or The Easy Artificial Intelligence platform really is just that, an Open Source platform to make training, running and deploying Artificial Intelligence models a whole lot easier.
With EZEE AI, you can now create deep learning models graphically and intuitively. No need for coding, just drag ‘n drop your data files, create and train your deep learning model and train your deep learning model with a few mouse clicks! After that, deploying your model becomes very easy.
EZEE AI was originally developed by Machine2Learn’s research team to make their own lives a lot easier. With EZEE AI, they could, for example, quickly assess the predictive possibilities of customer datasets. When word got out, other data scientists and academics became so enthusiastic, we decided to make EZEE AI available to others.
2.1. Why EZEE AI?
- Intuitive, easy to understand Graphic User Interface.
- No coding required just drag & drop datasets.
- Visually create deep learning models.
- Start training models in a matter of minutes.
- Understand and explain certain outcomes i.e. for GDPR.
- Make your models easily deployable.
- No technical background required.
- Open source software licence.
You do not need much experience with deep learning or coding to use EZEE AI. That’s why EZEE AI is now used by many users around the world, ranging from high school students and academics to data scientists and business managers.
2.2. What can you do with EZEE AI?
- Simply upload datasets easily by drag ‘n drop upload.
- Use e.g. CSV file datasets.
- Automatically detect feature types and change manually.
- Use out of the box deep learning models for regression and classification.
- Choose out of the box models or create new ones and compare their results.
- Easily manage your models.
- Intuitively design deep learning model architectures.
- Specify and choose your features.
- Tune hyper-parameters.
- Graphically log and see the progress of the model metrics such as accuracy, loss and r2.
- Use Tensorflow, Google’s open source machine learning framework.
- Run it on any cloud platform.
- Automatically create docker containers to deploy and run trained models in production environments.
- Use explainability, a unique functionality enabling you to explain what the model is actually doing. This is especially important for GDPR.
3. Get Started
3.1. Installation
3.1.1. Python
First get the publicly available GitHub repository on your local machine.
git clone https://github.com/machine2learn/ezeeai.git
We assume that Python 3 is the default python interpreter. From the terminal, go to the ezeeai root folder and run the following command to install all required packages.
pip install -r requirements.txt
In a terminal, execute the following command (Python 3 is the assumed python interpreter).
python wsgi.py
3.1.2. Docker
You can start a docker container with the EzeeAI published image.
docker run -p 5000:5000 -p 55500:55600 machine2learn/ezeeai
To save your model after docker finishes you can also mount a volume to /tmp/data like.
docker run -p 5000:5000 -p 55500-55600:55500-55600 -v $(pwd)/data:/tmp/data machine2learn/ezeeai
3.2. Logging In
You can use the application by launching chrome browser and connecting to http://localhost:5000.
To login you can use the following credentials.
| Username | Password |
|---|---|
| test | test_machine2learn |
4. Tutorials
In these tutorials we will guide you through two example procedures for developing effective neural network models.
- For regression, we will use built-in layers to make a neural network similar to the one used in this example.
- For classification, we will create a custom neural network for image processing.
These boxes will contain brief explanation of relevant machine learning concept and related reference to additional material.
4.1. Regression
The first tutorial will focus on developing a regression for tabular data.
- Regression consist in developing a model that predict the values of a continuous variable based on the values of other variables
- Tabular data are any data that can be expressed in the form of a table
- Features corresponds to the columns of our tabular data
- Target is the column of our tabular data that we want to predict
The goal is to develop a model that, given a customer profile, can predict the amount of money this person is willing to pay for buying a car.
The profile customers have the following features:
agegendermiles(average miles driven per day)debt(personal debt)income(monthly income)
while the target sale is the value of the purchased car.
4.1.1. Upload tabular data
The first steps for the development of any AI model is data loading.
We will upload in EzeeAI a dataset called cars collecting customer profiles and the price they payed
A good dataset should satisfy the following characteristics:
- Relevant information contained in the data must be informative for the task: the data features should be sensibly related to the target and the data points (rows) should be somehow related to the data points to which the model will be applied
- Rich in general, the more data points (rows), the better the model can learn
- Reliable features should be accurate and have low biases
- Repleted few missing values
- Download
cars.csvfile from here to your computer - On the left menu, go to
Datasets > Tabular - On the
Upload Databox (top left), click on theBrowsebutton belowTrain dataset in CSV formatand select thecars.csvfile - To complete the file upload, click on the
Savebutton of theUpload Databox. A blue loading bar will appear, and the completion of the upload will be signaled by the writingFile upload completed.
The Choose Data box below should now contain an entry named cars.
4.1.1.1. Visualization
We can now have a first look at our cars data.
By selecting cars in the Choose Data box, the following boxes will start displaying information:
Raw Datadisplays the data through a simple table, where each row corresponds to the first 10 data point (a customer, in this case) and each column correspond to a feature. We can scroll among all the other data points with the buttons at the bottom.Scatter Plotis a simple but effective tool to visually grasp the pairwise relations between the data. Each plotted point corresponds to a datapoint , whereand are its values for two features or target of your choice. - By setting
x-axistoincomeandy-axistosale, notice thatsaleincreases withincome.
- By setting
Feature Histogramshows the histogram and the inferred probability density function for the selected feature; it allows to spot biases and outliers.- The distribution of
milesis concentrate on values below 30 and rarely goes beyond 50.
- The distribution of
Heat Mapgives an overview of the linear relations between features and targets by plotting their pairwise Pearson Correlation Coefficients (PCC); the actual coefficients can be visualized by hoovering over the respective rectangle.debtandmilesare a somehow positively linearly correlated (PCC=0.54) whilegenderandagehave no linear correlation (PCC=0)
Additional visualizations are available by clicking on Show report at the bottom of the page.
4.1.2. Model Creation
Now that we have uploaded our data, we can start building the model. We will create the InputLayer node, that is the first node of the network, and add to it the data cars; then we create the rest of the network and add the loss function node at the very end.
Loss function is the tool used by the network to understand how good its predictions are. Essentially, it is a mathematical function that takes high values for bad predictions and low value for good predictions.
On the left menu, go to Models.
Here is the blank draw grid where we are going to design our model.
We will simply need to select nodes from the blue menu and then click on the canvas to paste them; then we create the connection by clicking on the center top of the source node and drag the line to the destination node.
In the remainder of this section, we will simply call menu this blue menu on the left of the Models page.
4.1.2.1. Input Layer Creation
We now create the InputLayer_0 node with the cars data.
On the menu, select Input Layers > InputLayer.
-
Create the
InputLayer_0node by clicking in any place of the draw grid. -
Right click on the
InputLayer_0node and selectadd input data -
The
Input Layerwindow will appear. Selectcarsamong the datasets and clickContinueto go to theSplittab. -
Now is the time to split your
carsdataset in Train, Validation, and Test data by dragging the percentage bar. We recommend in this case to set Train to 70%, Validation to 20% and Test to 10%. Then clickContinueto go to theFeaturestab.Reference material on the importance of data splitting Blog
- https://machinelearningmastery.com/difference-test-validation-datasets/
- https://towardsdatascience.com/train-validation-and-test-sets-72cb40cba9e7
- https://cs230-stanford.github.io/train-dev-test-split.html
Video
-
In the
Featurestab we have to select the feature to be used and their categories.-
Details on the features categories
-
Reference material on data normalization
Blog
Video
- Select
genderascategoricalbecause the gender has no meaningful order. - Select all the remaining features as
Numerical. - Tick
Normalizebecause without normalized feature training the neural network will be harder. - Click
Continueto go to theTargetstab.
-
-
In the
Targetstab we have to select the feature to be used as target; selectsalesand click onSave.
4.1.2.2. Network Creation
We now create a collection of dense layers by creating just one DNN_0 node. We select Canned Model > DNN and then clicking on the grid:
- Connect
InputLayer_0toDNN_0: hold click on the center top ofInputLayer_0and drag to theDNN_0till the arrow appears - Setup
DNN_0to have 2 hidden layers of 12 and 8, ReLu as activation function, and initialize the weights to random values generated from a standard normal distribution; a final 1-node layer with linear activation function will be added automatically at the end of the DNN node:-
Left-click on the node; the property menu will appear on the right.
-
Set
hidden_layersto12,8 -
Set
kernel_initializertorandomNormal
-
4.1.2.3. Loss Node Creation and Model Saving
-
Now we have to create the loss function node
Loss_0. We selectLoss Functions > Lossand then clicking on the grid.-
Connect
DNN_0toLoss_0 -
By accessing the property menu, you can check that the mean squared error is used as the loss function
-
-
Now the model is ready: name it
cars_modelon the top leftModel name, then check its correctness and save it by clickingValidateandSave
4.1.3. Model training
Now that we have a model designed, it is time to train and see how it performs on train and validation data.
- On the left menu, go to
Train > Run - In the
Run Configmenu, go toModeland selectcars_model
4.1.3.1. Experiment&Training parameters
EzeeAI allows to tune our training parameters very easily. In this tutorial will just focus on two training parameters:
-
In the
Run Configmenu, setNumber of epochsto 150 andBatch sizeto 50.- This means that the model will go through all the train data for 150 cycles; at each iteration performed within each epoch, 50 data points will be used to update the network. Hence the model will take 3 iterations to complete one epoch.
-
Start the training by clicking on the play button:
4.1.3.2. Training visualization
After a few seconds, the boxes belows the play button will start to visualize information on the model performances:
-
The
Checkpointsbox indicates the model performance saved for different point in time during the training. Each checkpoint is a saving of the model, and is identified by the number of iterations performed when the model was saved. The number of saved checkpoint is currently 5 and they are saved after 50 iterations, as specified by the parametersMaximum # of checkpointsandSave checkpoints afterin theRun Configmenu, respectively:The R-squared, also called the coefficient of determination, measure the quality of the prediction; it is a value lower than 1, where 1 indicates perfect linear agreement
- As hoped, as the iterations increase the R-squared increases toward maximum potential value 1 while the Loss decreases toward the minimum potential value 0, therefore indicating that the model performance on the train data is improving.
-
The other two boxes show the graphs of the Loss and the R-squared measured for different steps; both the Loss and the R-squared are compute both on the train data and the validation data
Much better model performance on the train data would have signaled that our model is overfitting, that means the model is too influenced by the train data and could have performance issue on other datasets.
- As the steps increase, the two measures have similar values for the train data and the validation data.
4.1.3.3. TensorBoard
Additional details on the model training can be visualized through the Google Tensorflow board, that is accessible from them menu in Run > Tensorboard:
4.1.4. Inference
4.1.4.1. Predict
Sometimes you want to see how your model would behave on a specific datapoint and play a bit with its features. EzeeAI allows that.
-
On the left menu, go to
Predict -
Select a checkpoint: in the
Modelsection, selectcars_model; the checkpoints table will appear. Pick the ones with the best R-squared. -
Now we can set the datapoint values to what we want and see the outcome. A box named
Your Featureswill appear; setdebtto 39999 andincometo 2000. Then clickPredict.- We get a prediction of 17444.355. This means that, according to our model trained on the train data, a 25-year-old woman, who commutes 23 miles per day, has a debt of USD 40k and a monthly income of USD 2000 should be willing to spend about USD 17.5k to buy a second-hand car.
4.1.4.2. Explainability
In some situation we would really like to understand why we get a certain prediction from the model. EzeeAI can give you some hints.
-
On the left menu, go to
Explain -
Select a checkpoint: in the
Modelsection, selectcars_model; the checkpoints table will appear. Pick the ones with the best R-squared. -
Now we can set the datapoint values to what we want and see the outcome. A box named
Your Featureswill appear; setdebtto 40000 andincometo 2000. Then clickPredict. -
Let us set the explainability parameters. In the bottom part of the
Your Featuresbox, we can select the number of most explaining features to be displayed in the box on the right; let's live#Featuresto 3. The fieldTop labelsis only used for explaining classification outputs so we leave it set to 1 (for classification, we can set it up to the number of classes in the data).
By clicking Explain, the following boxes will visualize our results:
-
Prediction Outputsimply visualizes the prediction as an histogram; the number at the top and the bottom of the y axis are the minimum and the maximum potential value a prediction of our model could give- Notice that the range of potential prediction is very high, starting from less than USD 2000 to USD 320k
-
Your Explanationshows the explanation of what contributed to determine the prediction. This is based on 3 top explaining features, as specified by#Featuresvalue of theExplain Params. The label on the left indicates the logical condition to which the score refers to, and the score is an indicator of how much it contributed to make the final prediction higher or lower.- Most of the prediction is determined by the fact that the debt is higher than USD 18126.50; the fact that the monthly income is below USD 3349 reduced the estimated sale price. The gender has basically no role in determining the prediction
The explainability analysis is performed via the LIME library available on GitHub and described in this research paper.
This is a brief description of the method extracted from the GitHub page:
Intuitively, an explanation is a local linear approximation of the model's behavior. While the model may be very complex globally, it is easier to approximate it around the vicinity of a particular instance. While treating the model as a black box, we perturb the instance we want to explain and learn a sparse linear model around it, as an explanation.
4.1.4.3. Test
We now look at the performance of our model on the test data; these data have not been seen by the model so far, so it can be very informative on the generalizability of the model. To this aim, we need to choose a model (i.e. checkpoint) to be tested and the data on which we want to assess the performances.
-
On the left menu, go to
Test -
Select a checkpoint: in the
Modelsection, selectcars_model; the checkpoints table will appear. Pick the ones with the best R-squared. -
Select the test data: after you select a checkpoint, select
cars_split_test.csvbeneathSelect a test file.
By clicking Test, the following boxes will visualize our results:
Your Predictionssimilarly to theRaw Datatable we saw earlier, it displays the data and the predicted target value through a simple table, where each row corresponds to the first 10 data point (a customer, in this case) and each column correspond to a feature. We can scroll among all the other data points with the buttons at the bottom.Predicted vs. Actual Responseis a scatterplot of the test data point; the x-axis correspond to the actual target feature value while the y-axis shows the predicted target value.- The model tends to overestimate the sale budget up to 10k and underestimate it between 10k and 20k
4.2 Classification
This second tutorial focuses on classification in the context of image data.
The goal is to develop a model that, given an input image, it can predict at what image class it belongs. We will work with a dataset called cifar10 collecting containing 10 evenly-distributed image classes. The 10 different classes represent airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships, and trucks. There are 6,000 images of each class.[4]
4.2.1. Upload image data
The first steps for the development of any AI model is data loading.
We will upload in EzeeAI the cifar10 dataset.
-
Download
cifar10-10-python.tar.gzdata to your computer and extract thecifar10.npyfile from the archive -
On the left menu, go to
Datasets > Image -
On the
Upload Databox (top left), atSelect format optionchooseNumpy file, then click on theBrowsebutton below and select thecifar10.npyfile -
To complete the file upload, click on the
Savebutton of theUpload Databox. A blue loading bar will appear, and the completion of the upload will be signaled by the writingFile upload completed.
The Choose Data box below should now contain an entry named cifar10.
4.2.1.1. Visualization
We can now have a first look at our cifar10 data.
By selecting cifar10 in the Choose Data box, the following boxes will start displaying information:
Sample Imagesshows our first image in the data according order in the input file.- We can see that is an airplane. Clicking on the thumbnail images, we can check that the second is a car, the third is a bird and the fourth is a cat.
Label Distributionis an histogram showing the distribution of the images according to their class labels.- Each class contains 5000 images.
4.2.2. Model Creation
Now that we have uploaded our data, we can start building the model. We will create the InputLayer node, that is the first node of the network, and add to it the data cifar10 with some additional images automatically generated from it; then we create the rest of the network and add the loss function node at the very end.
Loss function is the tool used by the network to understand how good its predictions are. Essentially, it is a mathematical function that takes high values for bad predictions and low value for good predictions
On the left menu, go to Models.
Here is the blank draw grid where we are going to design our model.
We will simply need to select nodes from the blue menu and then click on the canvas to paste them; then we create the connection by clicking on the center top of the source node and drag the line to the destination node.
In the remainder of this section, we will simply call menu this blue menu on the left of the Models page.
4.2.2.1. Input Layer Creation
We now create the InputLayer_0 node with the cifar10 data.
On the menu, select Input Layers > InputLayer.
- Create the
InputLayer_0node by clicking in any place of the draw grid. - Right click on the
InputLayer_0node and selectadd input data
-
The
Input Layerwindow will appear. Selectcifar10among the datasets and clickContinueto go to theSplittab. -
Now is the time to split your
cifar10dataset in Train, Validation, and Test data by dragging the percentage bar. We recommend in this case to set Train to 70%, Validation to 20% and Test to 10%. Then clickContinueto go to theFeaturestab. -
Deep Learning models benefits by being trained on high amount of data. To increase our dataset, we perform what is called data augmentation
Data augmentation is a way to increase our data samples. It consists in generate new realistic data samples by applying transformations to the available data samples. The transformations simulate the representation of the original samples under different conditions.
-
Now we are going to apply some data transformation to our images: rotation and horizontal flip:
-
From
Data Augmentationlist selectFlipandRotation. Then press the>symbol on top-right. The two rows will now appear on theSelectedmenu -
Select
Flipand tick theHorizontal Flipbox -
Select
Rotationand set the values to0and6.28, so that all possible rotations can be done
-
-
Now we can click on
Continueand thenSave
4.2.2.2. Node Creation
-
Now we create the rest of the network; let's create the first node
Conv2D_0corresponding to a Convolutional Neural Network (CNN) layer. We create a network with 32 2-dimensional filters with kernel window size 3x3; padding will be such that the output has the same length as the original input. Then it will be followed by aReLuactivation function.Fur further information on CNN https://www.youtube.com/watch?v=YRhxdVk_sIs
-
On the left menu with the node models, click
Convolutional Layers > Conv2Dand then click anywhere in the grid. -
To configure the node, do a left-click on it and the configuration menu will appear on the right
-
Set the following parameters:
kernel_sizeto[3, 3]filterto 32paddingtosame
-
Connect
InputLayer_0toConv2D_0: hold click on the center top ofInputLayer_0and drag to theConv2D_0till the arrow appears.
-
-
Similarly, we create another convolutional layer by duplicating the previous one and switch to the default padding.
-
Right-click on
Conv2D_0node and selectduplicate -
Left-click and check that the node is configured as
Conv2D_1. Then changepaddingtovalid. -
Connect
Conv2D_1withConv2D_0
-
-
We can now create the first Maximum Pooling layer
MaxPooling2D_0with a 2x2 pooling window size.-
On the left menu with the node models, click
Pooling Layers > MaxPooling2Dand then click anywhere in the grid. -
Left-click on the
MaxPooling2D_0node and in the configuration menu set bothpool_sizeandstridesto[2, 2]. Then connect it toConv2D_1
-
-
To reduce overfitting we put here a Dropout
Dropout_0node with 25% dropout rate. Then we save the network-
On the left menu with the node models, click
Core Layers > Dropoutand then click anywhere in the grid. -
Left-click on the
Dropout_0node and in the configuration menu setrateto0.25. Then connect it toMaxPooling2D_0 -
Let's save what we have done so far. On the top left of the grid, click on
new_modeland replace it withcifar10_model. At the bottom-right corner of the screen, click onSaveto save the model withcifar10_modelname. Since our model cannot be validated yet, we'll have to store it without the input data.
-
4.2.2.3. Group Creation
The next four nodes are very similar to the last four. So the fastest way to make them is to transform the previous one in a group, duplicate it, and edit what we want
-
While keeping the key Shift pressed, left-click on the latest four nodes (
Conv2D_0,Conv2D_1,MaxPooling2D_0,Dropout_0) -
Right-click on any of those nodes and select
group nodes -
Right-click on the newly created group
block_0and selectduplicate -
A new group will appear; edit its
Conv2D_2andConv2D_3nodes such that theirfiltersvalues are 64 -
Connect
Dropout_0toConv2D_2
4.2.2.4. Complete Network, Loss Node Creation, and Model Saving
-
The next series of nodes will remove the spatial structure of the network and output 10 positives values, one per class. The nodes have to be connected to the previous ones in the order of appearance.
-
First we flatten the last 2-dimensional network layer by adding a Flatten node: select it from the left menu
Core Layers > Flatten -
Then we add a Dense node (also called fully-connected): select it from the left menu
Core Layers > Denseand setunitsto512 -
We put a
Dropoutnode again, but this time with 50% rate (setrateto0.5) -
Finally we add a final
Densenode with 10 units and no activation function (setactivationtolinear). We call itDense_1
-
-
Now we have to create the loss function node
Loss_0. We selectLoss Functions > Lossand then clicking on the grid.-
Connect
Dense_0toLoss_0 -
By accessing the property menu, you can check that the
softmax_cross_entropyis used as the loss function:
-
-
Now we check that everything is correct. On the bottom-right of the grid, click on the button
Validate, and thenSave:
4.2.3. Model training
Now that we have a model designed, it is time to train and see how it performs on train and validation data.
- On the left menu, go to
Train > Run - In the
Run Configmenu, go toModeland selectcifar10_model
4.2.3.1. Experiment&Training parameters
EzeeAI allows to tune our training parameters very easily. In this tutorial will just focus on two training parameters:
-
In the
Run Configmenu, set:Number of epochsto 10000OptimizertoRMSPropLearning rateto 0.0001
-
Start the training by clicking on the play button